home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
rtnews.zip
/
RTNV2N8
< prev
next >
Wrap
Text File
|
1992-09-13
|
19KB
|
347 lines
_ __ ______ _ __
' ) ) / ' ) )
/--' __. __ , --/ __ __. _. o ____ _, / / _ , , , _
/ \_(_/|_/ (_/_ (_/ / (_(_/|_(__<_/ / <_(_)_ / (_</_(_(_/_/_)_
/ /|
' |/
"Light Makes Right"
October 27, 1989
Volume 2, Number 8
Compiled by Eric Haines, 3D/Eye Inc, 2359 Triphammer Rd, Ithaca, NY 14850
NOTE ADDRESS CHANGE: wrath.cs.cornell.edu!eye!erich
[distributed by Michael Cohen <m-cohen@cs.utah.edu>, but send
contributions and subscriptions requests to Eric Haines]
All contents are US copyright (c) 1989 by the individual authors
Archive locations: anonymous FTP at cs.uoregon.edu (128.223.4.1) and at
freedom.graphics.cornell.edu (128.84.247.85), /pub/RTNews
Contents:
Introduction
Tracing Tricks, edited by Eric Haines
-------------------------------------------------------------------------------
Introduction
I've decided to pass on an article published in the SIGGRAPH '89
"Introduction to Ray Tracing" course notes. It's something of a "best of the
Ray Tracing News" compendium of ideas. Since the notes are not easy for
everyone to access, and the article probably will not be printed elsewhere, I
thought it worthwhile to reprint here.
-------------------------------------------------------------------------------
Tracing Tricks, edited by Eric Haines
Over the years I have learnt a variety of tricks to increase the performance
and image quality of my ray tracer. It's almost a cliche that today's
successful trick is tomorrow's established technique. Photorealistic computer
graphics is, after all, concerned with figuring out shortcuts and
approximations for rendering various physical phenomena, i.e. tricks.
For whatever reason, many of the tricks mentioned here are not common
knowledge. Some have been published (and sometimes overlooked), some have
been discussed informally and have never made it into research papers, and
others seem to have appeared out of nowhere. It's most likely that there are
tricks that are commonly known that have not percolated over to me yet.
When possible, I have tried to give appropriate references or attributions; if
not attributed, the ideas are my own (I think!). My apologies if I have
overlooked anyone. Only references that do not appear in the book's "Ray
Tracing Bibliography" are included at the end of this article. For more
general rendering hacks, see [Whitted85], which originally inspired me to
attempt to pass on some ideas from my bag of tricks.
Ambient Light
One common trick (origins unknown) is to put a light at the eye to do better
ambient lighting. Normally if a surface is lit by only ambient light, its
shading is pretty crummy. For example, a non-reflective cube totally in
shadow will have all of its faces shaded the exact same shade. All edges
disappear and the cube becomes a hexagonal blob. The light at the eye gives
the cube definition. Note that a light at the eye does not need shadow
testing: wherever the eye can see, the light can see, and vice versa.
However, this trick can lead to various artifacts, e.g. there will always be
a highlight near the center of every specular sphere in the image.
Efficiency Schemes
There are any number of efficiency schemes out there, including Bounding
Volume Hierarchy, Octree, Grid, and 5D Ray Classification. See Jim Arvo's
section of the book for an excellent overview of all of these. The most
important conclusion is that any efficiency scheme is better than none. Even
on the simplest scenes an efficiency scheme will help execution. For example,
in one test scene with only ten objects, using an efficiency scheme made the
job take only one third the time. Grid subdivision is probably the quickest
to implement, though the others are not that much harder.
While at the University of Utah, John Peterson and Tom Malley actually
implemented Whitted/Rubin, Kay/Kajiya, and an octree scheme, and found that
all three schemes were within 10-20% of each other speedwise. In an informal
survey at SIGGRAPH '88, the BV Hierarchy, Octree, Grid and 5D schemes all had
about the same number of users (all the 5D users were from Apollo; on the
other hand, 5D is the new kid on the block).
There are a number of techniques I have found to be generally useful for all
efficiency schemes.
1) When shadow testing, keep the opaque object (if any) which shadowed each
light for each ray tree node. Try this object immediately during the next
shadow test at that ray tree node. Odds are that whatever shadowed your
last intersection point will shadow again. If the object is hit you can
immediately stop testing because the light is not seen. This was first
published in [Haines86].
2) When shadow testing, save transparent objects for later intersection. Only
if no opaque object is hit should the transparent objects be tested. The
idea here is to avoid doing work on transparent filters when in fact the
light does not reach the surface.
3) Don't calculate the normal for each intersection. Get the normal only
after all intersection calculations are done and the closest object for
each node is known. After all, each ray can have only one intersection
point and one normal. Saving intermediate results is worthwhile for some
intersection calculations, which are then used if the object is actually
hit. This idea was first mentioned in [Whitted85]. Similarly, other
calculations about the surface can be delayed, such as (u,v) location, etc.
4) One other idea (which I have not tested) is sorting each intersection list
by various criteria. Most efficiency schemes have in common the idea of
lists of objects to be tested. For a given list, the order of testing is
important. For example, all else being equal, if a list contained a spline
surface and a polygon, I would want to test the polygon first since it is
usually a quicker intersection test. Given an opaque object and a bounding
box in a list, I probably want to test the opaque object first when doing
shadow testing, since I want to find any intersection as soon as possible.
If two polygons are on the list, I probably want to test the larger one
first, as it is more likely to cast a shadow or give me a maximum depth
(see next section). There are many variations on this theme and at this
point little work has been done on these possibilities.
Bounding Volume Hierarchy
I have a strong bias towards this scheme since it handles a wide variety of
object sizes, types, and orientations in a robust fashion. Other schemes will
often be faster, but this scheme has the fewest crippling pathological cases
(e.g. a grid subdivision scheme is useless whenever most of the objects fall
into one grid box). I favor the automatic bounding volume generation technique
described by [Goldsmith87].
I have found a number of tricks to speed up hierarchy traversal, most of which
are simple to implement. Some of the ideas can also be useful for other
efficiency schemes.
1) Keep track of the closest intersection distance. Whenever an object is
hit, keep its distance as the maximum distance to search. During further
intersection testing use this distance to cut short the intersection
calculations: if an object or bounding box is beyond the maximum distance,
no further testing of it needs to be done. Note that for shadow testing
the distance to the light provides an initial maximum.
2) When building a ray intersection tree, keep the ray tree which was
previously built. For each ray tree node, intersect the object in the old
ray tree, then proceed to intersect the bounding box/object tree. By
intersecting the old object first you can usually obtain a good maximum
distance immediately, which can then be used to aid trick #1.
3) When shooting rays fr